<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="../../vue.js/vue.js"></script>
    <style>
      .bg {background-color: red;}
      .bg_b {background-color: blue;}
      .fs {font-size: 50px;}
      .fc {color: green;}
    </style>
  </head>
  <body>
    <div id="app">
      <!-- 字符串的写法 -->
      <!-- :class="bg_red"--邦的时data中定义好的数据 -->
      <!-- @click="change"---事件触发修改样式 -->
      <!-- <div :class="bg_red" @click="change">{{name}}</div> -->
      <!-- 对象的写法 -->
      <!-- <div :class="{ bg_b: true, fs: true }">{{name}}</div> -->
      <!-- 姜对象定义到data中 -->
      <!-- <div :class="obj">{{name}}</div> -->
      <!-- 数组的写法 -->
      <div :class="[{bg:c}, b]">{{name}}</div>
      <!-- 表达式 -->
      <div :class="[isTrue?a:d,b]">{{name}}</div>	
    </div>
    <script>
      new Vue({
        el: '#app',
        data: {
          name: 'Onion',
          obj: { bg_b: true, fs: true },
          list: ['bg', 'fs', 'fc'],
          a: 'bg',
          b: 'fs',
          c: true,
          d:'fc',
          bg_red:'bg',
          isTrue:false
        },
        methods: {
          change() {
            this.bg_red = 'bg_b';
          },
        },
      });
    </script>
  </body>
</html>
